package org.mogu.adapter;

import org.mogu.tools.HeaderPic;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.content.Context;
import android.widget.ImageView;
import android.widget.GridView;

public class HeaderGroupAdapter extends BaseAdapter {
	private Context mContext;
	private Integer[] headerArr;
	public HeaderGroupAdapter(Context c) {
		mContext = c;
		headerArr=HeaderPic.headerArr;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return headerArr.length;
	}
	
	

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub

		ImageView imageview;
		if (convertView == null) {
			imageview = new ImageView(mContext);
			imageview.setLayoutParams(new GridView.LayoutParams(80, 80));
			imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
			imageview.setPadding(1, 1, 1, 1);
		} else {
			imageview = (ImageView) convertView;
		}
//		imageview.setImageResource();
		imageview.setImageResource(headerArr[position]);
		return imageview;
	}
	
	 

}
